<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function People (name, age){
            this.name = name;
            this.age = age;
        }
        People.prototype.setName = function(name){
            this.name = name;
        }
        function Student (name, age, value){
            People.call(this, name, age);
        // call()可以让一个函数成为指定任意对象的方法进行调用   
        // 上面的代码相当于this.name = name; this.age = age;
            this.value = value;
        }
        
        Student.prototype = new People();
        // 为了可以调用父类中的方法
        Student.prototype.constructor = Student;
        // 修改constructor的指向
        Student.prototype.setValue = function(value){
            this.value = value; 
        }

        var s = new Student ("李华",18,15000);
        s.setValue(16000);
        s.setName("老王");
        console.log(s);
    </script>
</head>
<body>
    
</body>
</html>